working on it ...

Filters

Explore Public Snippets

Sort by

Found 114 snippets

    public by javalonson  2409  0  5  1

    Command to detect errors in php using php lint.

    find . -type f -name '*.php' -exec php -l {} \; |grep -v "No syntax errors detected"

    public by f8lrebel  5110  1  5  0

    Sublime Text 2 - Useful Shortcuts

    Sublime Text 2 - Useful Shortcuts: gistfile1.textile
    h1. Sublime Text 2 - Useful Shortcuts (Mac OS X)
    
    h2. General
    
    | *⌘T* | go to file |
    | *⌘⌃P* | go to project |
    | *⌘R* | go to methods |
    | *⌃G* | go to line |
    | *⌘KB* | toggle side bar |
    | *⌘⇧P* | command prompt |
    | *⌃ `* | python console |
    | *⌘⇧N* | new window (useful for new project) |
    
    h2. Editing
    
    | *⌘L* | select line (repeat select next lines) |
    | *⌘D* | select word (repeat select others occurrences in context for multiple editing) |
    | *⌃⇧M* | select content into brackets |
    | *⌘⇧↩* | insert line before |
    | *⌘↩* | inter line after |
    | *⌃⇧K* | delete line |
    | *⌘KK* | delete from cursor to end of line |
    | *⌘K⌫* | delete from cursor to start of line |
    | *⌘⇧D* | duplicate line(s) |
    | *⌘J* | join lines |
    | *⌘KU* | upper case |
    | *⌘KL* | lower case |
    | *⌘ /* | comment |
    | *⌘⌥ /* | block comment |
    | *⌘Y* | redo or repeat |
    | *⌘⇧V* | past and ident |
    | *⌃ space* | autocomplete (repeat to select next suggestion) |
    | *⌃M* | jump to matching brackets |
    | *⌘U* | soft undo (movement undo) |
    | *⌘⇧U* | soft redo (movement redo) |
    
    h2. XML/HTML
    
    | *⌘⇧A* | select content into tag |
    | *⌘⌥ .* | close tag |
    
    h2. Find/Replace
    
    | *⌘F* | find |
    | *⌘⌥F* | replace |
    | *⌘⌥G* | find next occurrence of current word |
    | *⌘⌃G* | select all occurrences of current word for multiple editing |
    | *⌘⇧F* | find in files |
    
    h2. Splits/Tabs
    
    | *⌘⌥1* | single column |
    | *⌘⌥2* | two columns |
    | *⌘⌥5* | grid (4 groups) |
    | *⌃[1,2,3,4]* | focus group |
    | *⌃⇧[1,2,3,4]* | move file to group |
    | *⌘[1,2,3...]* | select tab |
    
    h2. Bookmarks
    
    | *⌘F2* | toggle bookmark |
    | *F2* | next bookmark |
    | *⇧F2* | previous bookmark |
    | *⌘⇧F2* | clear bookmarks |
    
    h2. Marks
    
    | *⌘K space* | set mark // ⌘K; for me |
    | *⌘KW* | delete from cursor to mark |
    | *⌘KA* | select from cursor to mark |
    | *⌘KG* | clear mark |
    
    
    

    external by patrick-russell  16  0  1  0

    SUBLIME TEXT MAC- Keyboard's Shortcuts Cheat Sheet

    SUBLIME TEXT MAC- Keyboard's Shortcuts Cheat Sheet: sublime-mac.textile
    h1. Sublime Text 2 - Useful Shortcuts (Mac OS X)
    
    h2. General
    
    | *⌘T* | go to file |
    | *⌘⌃P* | go to project |
    | *⌘R* | go to methods |
    | *⌃G* | go to line |
    | *⌘KB* | toggle side bar |
    | *⌘⇧P* | command prompt |
    | *⌃ `* | python console |
    | *⌘⇧N* | new window (useful for new project) |
    
    h2. Editing
    
    | *⌘L* | select line (repeat select next lines) |
    | *⌘D* | select word (repeat select others occurrences in context for multiple editing) |
    | *⌃⇧M* | select content into brackets |
    | *⌘⇧↩* | insert line before |
    | *⌘↩* | inter line after |
    | *⌃⇧K* | delete line |
    | *⌘KK* | delete from cursor to end of line |
    | *⌘K⌫* | delete from cursor to start of line |
    | *⌘⇧D* | duplicate line(s) |
    | *⌘J* | join lines |
    | *⌘KU* | upper case |
    | *⌘KL* | lower case |
    | *⌘ /* | comment |
    | *⌘⌥ /* | block comment |
    | *⌘Y* | redo or repeat |
    | *⌘⇧V* | past and ident |
    | *⌃ space* | autocomplete (repeat to select next suggestion) |
    | *⌃M* | jump to matching brackets |
    | *⌘U* | soft undo (movement undo) |
    | *⌘⇧U* | soft redo (movement redo) |
    
    h2. XML/HTML
    
    | *⌘⇧A* | select content into tag |
    | *⌘⌥ .* | close tag |
    
    h2. Find/Replace
    
    | *⌘F* | find |
    | *⌘⌥F* | replace |
    | *⌘⌥G* | find next occurrence of current word |
    | *⌘⌃G* | select all occurrences of current word for multiple editing |
    | *⌘⇧F* | find in files |
    
    h2. Splits/Tabs
    
    | *⌘⌥1* | single column |
    | *⌘⌥2* | two columns |
    | *⌘⌥5* | grid (4 groups) |
    | *⌃[1,2,3,4]* | focus group |
    | *⌃⇧[1,2,3,4]* | move file to group |
    | *⌘[1,2,3...]* | select tab |
    
    h2. Bookmarks
    
    | *⌘F2* | toggle bookmark |
    | *F2* | next bookmark |
    | *⇧F2* | previous bookmark |
    | *⌘⇧F2* | clear bookmarks |
    
    h2. Marks
    
    | *⌘K space* | set mark // ⌘K; for me |
    | *⌘KW* | delete from cursor to mark |
    | *⌘KA* | select from cursor to mark |
    | *⌘KG* | clear mark |
    
    
    

    external by Lukasz Kalicki  56  2  1  0

    Crypto 20p

    Crypto 20p: gistfile1.textile
    h1. Bob uwielbia xorować
    
    _Bob zaszyfrował flagę w poniższym tekście. Odszyfruj text._
    
    _ps. Bob uwielbia xorować, na razie tylko pojedycznym bajtem..._
    
    _GCg7Ozs7Oy01e3oNMz4gP3ogP3ovPjs2NXoZM3opMz96KDUgKSAjPCg1LTs5_
    _ei4/MSkueiA7KSAjPCg1LTs0I3oqNTA/PiM0OSAjN3o4OzAuPzd0ehQ1ej41_
    _OCg7dno8Njs9O3ouNWB6CBUADRsWBSEJMzQ9Nj8CNSgYIy4/GTMqMj8oJw==_
    
    
    h1. Rozwiązanie: 
    * Złamać XOR o krótkim kluczu jest bardzo łatwo, wadą tego "szyfrowania" jest powtarzalność klucza w przypadku większego tekstu od klucza.
    * Pierwsze na co spojrzałem to znaki "==" na końcu które nie pasowały mi do XORa, a do Base64 (padding).
    * Zdekodowałem ten base64 i dostałem już coś co mi bardziej pasowało.
    * Jako że mamy doczynienia z jedno bajtowym kluczem takiego prostego xora możemy złamać brutując go wszystkimi kombinacjami klucza a następnie wyszukać w outpucie fraze związaną z "flag".
    * Następnie napisałem prosty skrypt w Pythonie który wiadomość zakodowaną wczytywał z pliku, robił na tekście base64.decode() 
    * Następnie prostą funkcję XOR'ującą podany tekst danym kluczem.
    * A następnie wystarczyło napisać prostą pętlę i przejść po wszystkich możliwych kombinacji klucza.
    * Output skryptu powędrował do pliku w którym na samym początku już było widać rozwiązanie  i to że klucz to był "0x2"
    * Wystarczyło jeszcze wyedytować dane do postaci flagi i mamy 20pkt.
    
    
     *_ROZWAL_{SINGLEXORBYTECIPHER}_*
    
    

    external by mehar  17  0  1  0

    Tmux, Bash, Vi key bindings

    Tmux, Bash, Vi key bindings: CheatSheet.textile
    | Bash - Command | Function | Description - Bash                             	|----|----| Tmux - Command | Function | Description - TMux |
    | ------- | -------- | ------------------                             	        ||| ------- | -------- | ------------------ |
    | C-Q | Clear Line | Clears everything on current line                	        ||| C-b | Prefix | |
    | C-L | Clear Screen | Clear the Screen				      	        ||| Prefix C-h | Show Help | |
    | C-U | Cut Backwards | Cut everything backwards to beginning of line	        ||| Prefix pipe/- | Split Pane Vertically/Horizontally | |
    | C-K | Cut Forwards | Cut everything forwards to the end of the line           ||| Prefix n/p | Next/Prev Window | Prefix Arrow - Pane |
    | C-W | Cut Word Back | Cut one word backwards				        ||| Prefix C-s | Toggle Synchronization | |
    | C-Y | Paste | Paste whatever was cut by the lst cut command		        ||| Prefix d | Detach | |
    | C-H | | Same as backspace						        ||| Prefix C-c | Copy buffer to OSX copy buffer | |
    | C-_ | | Undo the last command							||| Prefix ] | Paste | Prefix [ - Enter Copy Mode |
    | C-T | | Swap the last two characters before the cursor			||| Prefix z | Pane Zoom Toggle | Prefix hjkl - Resize Pane |
    | C-F | Char Forward | Move cursor one character forward			||| Prefix s | Select Sessions | Prefix w - Select Window |
    | C-B | Char Backward | Move cursor one character backward			||| Prefix Space | Toggle panes within layouts | |
    | Option -> | Word Forward | Move cursor one word forward			||| Prefix q/t | Show Panes/Time | |
    | Option <- | Word Backward | Move cursor one word backward			||| Prefix r | Reload tmux configuration | |
    | Esc T | | Swap the last two words before the cursor				||| | | |
    | | |										||| | | |
    | | |										||| | | |
    |---------------|-----------|---------------------------------------------------|----|----|---------|----------|-------------------------- |
    | vi - Command | Function | Description - vi					|----|----| Command | Function | Description VI |
    | 0 | Goto start of line | $ - Goto end of line 				|||| List/Kill Session | tmux list-sessions/kill-session 
    | w | Jump by start of words | e - Jump to end of words				|||| Tmuxinator | tmuxinator new/start <session-name> 
    | b | Jump backward by words |
    | a | Append after the cursor | A - Append at the end of the line		|||
    | :1,$d | Delete the whole file |
    | :%s/old/new/g | replace, use gc for confirmations				|||
    
    
    http://vimsheet.com/
    https://github.com/0nn0/terminal-mac-cheatsheet
    
    
    

    external by dronni3de  16  0  1  0

    Ruby on Rails best practices

    Ruby on Rails best practices: gistfile1.textile
    h1. Ruby on Rails best practices
    
    
    h2. Code style
    
    * Use UTF-8. It's 21 century, 8bit encodings dead now.
    * Use 2 space indent, not tabs
    * Use Unix-style line endings
    * Keep lines not longer than 80 chars
    * Remove trailing whitespace
    
    h2. Development process
    
    * Think
    * Describe
    * Write tests
    * Implement & go green
    * Rethink
    * Refactor
    
    h2. MVC
    
    * Follow MVC conventions
    * Do not ever mix logics: no model/view logic in controller, no view logic in model & etc.
    * Follow "Fat model, skinny controllers" methodology
    * If you have different data representation, use format aliases (e.g. different html views for same data: /users/:id.iphone)
    
    h3. Controllers
    
    * Keep it simple and clean
    * Keep ApplicationController clean. Commonly it should be used only for global filters and per-request logic (e.g locale configuration and access control)
    * Keep in mind that all @ApplicationController@ filters will be executed in each request and optimize it to be ultra-fast
    * Controllers should operate with abstract logic. Keep this logic simple and understandable without detailed review. E.g:
    
    <pre><code class="ruby"># Disgusting
      Account.transaction do
        transfer = @sender.orders.new(:action => :transfer, :receiver => @receiver, :ammount)
        
        if @sender.assets >= amount
          @sender.assets -= amount
          @receiver.assets += amount
        else
          flash[:error] = "Balance not enough to transfer funds"
          success = false
        end
        
        if @sender.save! and @receiver.save! and transfer.save!
          flash[:info] = "You have transferred #{ammount} to #{@receiver.last_name + "" + @receiver.first_name}"
          success = true
        else
          errors = ...
        end
      end
      
      if !success
        respond_to ...
      else
        respond_to ...
      end
    </code></pre>
    <pre><code class="ruby"># Much better, but not quite abstract
      Account.transaction do
        @sender.withdraw amount
        @receiver.deposit amount
      end
    
      if @sender.errors? or @receiver.errors?
        respond_to ...
      else
        respond_to ...
      end
    </code></pre>
    <pre><code class="ruby"># Best way
      if @sender.transfer!(amount, :to => @receiver)
        respond_to ...
      else
        respond_to 
      end
    </code></pre>  
    
    * View interaction in controllers always should be placed in @respond_to@ method or in responders (for Rails 3)
    * Do not place any logic in @respond_to@ method
    * Prefer :except in filters. E.g.: @before_filter :authorize!, :except => [:index]@ to be sure that new actions will be covered by filter by default
    * Follow REST convention: Commonly one controller should only operate one resource.
    * Follow REST convention naming. E.g.: @UsersController@ should operate only users. Groups operations should be placed in @GroupsController@
    * Follow HTTP methods conventions in REST actions: @DELETE@ for destructive action, @PUT@ for update, @POST@ to create, @GET@ to read
    * Use nested resources when needed. E.g: @map.resource :users {|user| user.resource :groups }@ instead of groups @action@ in @UsersController@
    * Avoid deep nesting where it's not necessary. E.g: Not @/places/:place_id/events/:event_id/users@ but @/events/:event_id/users@
    
    h3. Models
    
    * Keep it simple and clean
    * Model, method and variable names should be obvious
    * Do not use shortcuts and avoid non widely used abbreviation for model names. (e.g UsrHst or UserHist should be UserHistory)
    * Don't repeat yourself
    * Don't repeat rails. Zero custom code that duplicates rails built-in functionality
    * If you use find with similar condition in more than once — use @named_scope@
    * If you use same code in more than one model turn it into module/library
    * Prefer XML Builder over to_xml overrides
    
    h3. Views
    
    * Views is for presentation. DO NOT EVER CHANGE STATE OF ANYTHING IN VIEW
    * Keep views simple
    * Move complex logic to helpers
    * Move HTML markup generation to helpers
    * Do not use finders in views
    * DRY. Use partials, but keep in mind that partials can be really slow
    * Keep HTML markup semantic an clean
    * Do not inline any Javascript code. It should be unobtrusive
    
    h2. Tests
    
    * Follow Test Driven Development methodology: write tests, then code
    * Keep tests simple and easy understandable
    * Test everything what should be tested. If something can be broken: try to broke it by test
    * Do not test rails built-in methods, test method usage
    
    h2. Comments and documentation
    
    * Respect other developers: use only English
    * rdoc your friend, not enemy. Let application be self-documented
    * More is better than less: it's better to excess, than hold back
    
    
    

    external by Chris Blackwell  19  0  1  0

    Sublime 3 Shortcuts

    Sublime 3 Shortcuts: gistfile1.textile
    h1. Sublime Text 3 - Useful Shortcuts (Mac)
    
    See Sublime's "full documentation":http://www.sublimetext.com/docs/3/ for more shortcuts and helpers.
    
    h2. Editing
    
    | *⌘+C* | copy current line (if no selection) |
    | *⌘+X* | cut current line (if no selection) |
    | *⌘+⇧+K*| delete line |
    | *⌘+↩* | insert line after |
    | *⌘+⇧+↩* | insert line before |
    | *⌘+⇧+↑* | move line (or selection) up |
    | *⌘+L* | select line (repeat to select next lines) |
    | *⌘+D* | select word (repeat select others occurrences in context for multiple editing) |
    | *⌘+M* | jump to closing bracket for current code, repeat to jump to opening bracket |
    | *⌘+⇧+M* | select all contents of the current brackets (curly brackets, square brackets, parentheses) |
    | *⌘+KK* | delete from cursor to end of line |
    | *⌘+K+⌫* | delete from cursor to start of line |
    | *⌘+]* | indent current line(s) |
    | *⌘+[* | un-indent current line(s) |
    | *⌘+⇧+D* | duplicate line(s) |
    | *⌘+J* | join line below to the end of the current line |
    | *⌘+ /* | comment/un-comment current line |
    | *⌘+⇧+/* | block comment current selection |
    | *⌘+Y* | redo, or repeat last keyboard shortcut command |
    | *⌘+⇧+V* | paste and indent correctly |
    | *⌘+Space* | select next auto-complete suggestion |
    | *⌘+U* | soft undo (somehow undoes your movements; it jumps to your last change before undoing it when you repeat this command) |
    
    h2. Navigation/Goto Anywhere
    
    | *⌘+P* | quick-open files by name in your project (doesn't seem to need an actual project set up, it just searches in the directories around the currently-opened file |
    | *⌘+R* | goto symbol (functions and classes) in the file. Same as *⌘+P*, then type *@*|
    | *⌘+;* | goto word in current file. Same as *⌘+P*, then type *#*|
    | *⌘+G* | goto line in current file. Same as *⌘+P*, then type *:*|
    
    h2. General
    
    | *⌘+⇧+P* | command prompt |
    | *⌘+KB* | toggle side bar |
    
    h2. Find/Replace
    
    | *⌘+F* | find |
    | *⌘+H* | replace |
    | *⌘+⇧+F* | find in files |
    
    h2. Tabs
    
    | *⌘+⇧+t* | open last closed tab (just like in your browser) |
    | *⌘+PgDn*| cycle down through open tabs, cycle up with ⌘+PgUp |
    | *⌘+⇆* | cycle through last tabs (repeat to go back further in history) |
    
    h2. Split window
    
    | *Alt+⇧+2* | split into two columns |
    | *Alt+⇧+1* | revert to single column |
    | *Alt+⇧+5* | grid (4 groups) |
    | *⌘+[1,2,3,4]* | jump to "group" (pane) |
    | *⌘+⇧+[1,2,3,4]* | move file to specified group |
    
    h2. Bookmarks
    
    | *⌘+F2* | toggle bookmark |
    | *F2* | next bookmark |
    | *⇧+F2* | previous bookmark |
    | *⌘+⇧+F2* | clear bookmarks |
    
    h2. Text manipulation
    
    | *⌘+KU* | upper case |
    | *⌘+KL* | lower case |
    
    

    external by Miodrag Milic  31  0  1  0

    Paradajz čorba #recepti #paradajz #supa

    Paradajz čorba #recepti #paradajz #supa: paradajz corba.textile
    h1=. Paradajz čorba
    
    h2. Sastojci
    
    | 0.5 | čen      | beli luk                  |
    | 500 | ml       | sok od paradajza          |
    | 500 | ml       | voda                      |
    | 2   | kašika   | brašno                    |
    | 1   | kašičica | šećer                     |
    |     |          | sremuš, celer, peršun, so |
    
    h2. Priprema
    
    Na ulju na slaboj temperaturi dinstanti sitno seckani beli luk do 5 minuta. Dodati brašno i mešati još minut. Dodati sok od paradajza i vodu, šećer, zatim sve začine po ukusu. Na tihoj vatri kuvati još 15ak minuta tako da upari paradajz.
    
    
    h2. Note
    
    * Šećer se dodaje da umanji gorčinu paradajza.
    * Na viskoj temperaturi paradajz se prevene i bude gorči.
    
    

    external by Gabriela Seabra  91  0  1  0

    Remote Pair Programming sucks. Here's how to solve it.

    Remote Pair Programming sucks. Here's how to solve it.: gistfile1.textile
    REAL WORLD SCENARIO (blinking lights)
    
    Mr. Tom Dev wants to remote pair program with Mr. Todd Programmer.  Tom is in New York, Todd is in San Francisco.  They're working on yet another blog written in Ruby.  Tom fires up Rubymine, Todd fires up TextMate.
    
    Todd's editor quickly alerts him that he is connected with Tom and that their projects are out of sync.  The plugin gives them each the option of using Tom's file versions, Todd's files, or performing a git pull request.  They both do a git pull and are back in sync.
    
    Todd quickly opens the User model in Rubymine with cmd-shift-N and Todd quickly sees that same file opened in Textmate.  Todd then highlights a method that has been failing a test and Tom sees that highlight.   Todd makes the change to the file, clicks cmd-s, and that file change is synced over to Tom.
    
    Tom thought there was a secondary change needed in the Profile model, so he hits cmd-T, opens the Profile model and Todd sees that file opened in Rubymine.  Todd tells Tom that he's smoking catnip, that the bug he was referring to was closed weeks ago.
    
    Todd wants to show Tom what the blog looks like so far. Todd is running a local Rails instance.  Luckily Todd's Github plugin is signed in to the Github tunneling service, so Tom simply visits http://coolblog.github.com:3000/users/index and he's able to view Todd's local Rails instance.  Todd and Tom tweak CSS all night long.  Tech ecstasy. 
    
    ------------------------------------------------------
    
    Remote pair programming is difficult.  Screen sharing applications are laggy.  TMux with vim are challenging to setup and confine the user to utilize a strip down editor.
    
    Github is at the forefront of social programming and has a chance to take remote pair programming to the next level.  I propose the following features:
    
    1) A intermediary service that sends and receives high level actions from common development editor environments and sends/receives them between two connected developers. 
    
    2) Develop a series of plugins for the most common development editors; Eclipse, Netbeans, Rubymine, vim, Textmate, etc, that observe the programmer's actions within the editor and sends/receives those actions with the service outlined in item #1.
    
    2a) The plugin scans the opened project and sends the directory structure to the other remote developer so that inconsistencies in project files can be accounted for (e.g. the remote dev hasn't done a git pull so his checksums are different relative to the other remote developer).
    
    3) The plugin recognizes local file changes and automatically syncs them with the other remote developer.
    
    4) Provide a tunneling mechanism that allows for easy, local sharing of remote webserver instances (similar to http://progrium.com/localtunnel/).  
    
    ------------------------------------------------------
    
    ADVANTAGES :
    
    * Developers get to use their favorite environment with their favorite key-bindings. 
    
    * Speed; just sending file open/closes/switches would be much faster than sending entire screen updates.
    
    * The tunneling interface would provide a simple way for both developers to see either person's work.
    
    
    
    DISADVANTAGES :
    
    * This setup is primarily geared towards web developers.
    
    

    external by kadaj  11  0  1  0

    Textile syntax

    Textile syntax: Textile syntax
    Bold Text
    
    *this is bold* 
    
    ===========================
    
    Italic text
    
    _this is italic_
    
    ===========================
    
    Links
    
    "link text(title tooltip)":linkAddress
    
    Example - "Assistly(Assistly's website)":http://www.assistly.com
    
    ===========================
    
    Email Links
    
    "link text(title tooltip)":mailto:someone@example.com
    
    Example - "Support(Assistly Support)":mailto:support@assistly.com
    
    ===========================
    
    Images
    
    !imageurl(alt text)!
    
    Example - !http://upload.wikimedia.org/wikipedia/commons/thumb/b/be/Pygoscelis_papua.jpg/250px-Pygoscelis_papua.jpg(Hi)!
    
    ===========================
    
    Lists
    
    --Unordered
    
    * An item in a bulleted list
    ** Second Level
    *** Third level
    
    --Ordered
    
    # First list item 
    # Second list item 
    ## Second level list item
    
    ===========================
    
    Bullets usage examples
    
    * I am a bullet
    *# I am a numbered list in second level
    *# I am another numbered list in second level
    * I am another bullet in first level
    
    ===========================
    
    Headings
    
    You must leave a blank line after each heading.
    
    h1. First heading
    
    h2. Second heading
    
    h3. Third heading
    
    h4. Fourth heading
    
    h5. Fifth heading
    
    h6. Sixth heading
    
    ===========================
    
    Code
    
    @your code goes in here@
    
    Note: There can't be empty lines in the block of code.
    
    ===========================
    
    Blockquotes
    
    bq. This text will be enclosed in an HTML blockquote element.
    
    ===========================
    
    More markers
    	
    *_bold italic text_*	
    -strikethrough text-	
    *-bold strikethrough text-*	
    *_-bold italic strikethrough text-_*	
    +underlined text+	
    *+bold underlined text+*	
    _+italic underlined text+_	
    *_+bold italic underlined text+_*	
    *_-+bold italic strikethrough underlined text+-_*
    
    
    
    
    • Public Snippets
    • Channels Snippets