This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person(object): | |
| def __init__(self, name, age): | |
| self.name = name | |
| self.age = age | |
| def info(self): | |
| print("Name: %s - Age: %d" % (self.name, self.age)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Each container has their own state | |
| container1 = ScriptingContainer(); | |
| container2 = ScriptingContainer(); | |
| container1.set('x', '1234') # or just .eval('x = 1234') | |
| container2.set('x', '2345') # ^ | |
| container1.get('x') # => 1234 | |
| container2.get('x') # => 2345 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # oh-my-zsh Bureau Theme | |
| ### NVM | |
| ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b " | |
| ZSH_THEME_NVM_PROMPT_SUFFIX="" | |
| ### Git ‹±master ▾●› | |
| ZSH_THEME_GIT_PROMPT_PREFIX="‹%{$fg_bold[green]%}±%{$reset_color%}%{$fg_bold[white]%}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Group.find_by_name('XXX').projects.each { |x| x.update_column(:visibility_level, 0) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $config = YAML.load_file('config.yml')[env] | |
| $bot = Cinch::Bot.new do | |
| configure do |c| | |
| c.nick = $config['bot']['nick'] | |
| c.user = $config['bot']['user'] | |
| c.realname = "#{$config['bot']['realname']} - #{`git log --pretty=format:'%h' -n 1`} - #{env}" | |
| c.server = $config['bot']['server'] | |
| c.channels = $config['bot']['channels'] | |
| c.password = $config['bot']['password'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* To configure/use, add a block to the proxyscan{} section of your atheme.conf | |
| * like this: | |
| * | |
| * blacklists { | |
| * "dnsbl.dronebl.org"; | |
| * "rbl.efnetrbl.org"; | |
| * }; | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ time gcc test.c | |
| gcc test.c 0.02s user 0.18s system 69% cpu 0.293 total | |
| $ time emcc test.c | |
| emcc test.c 0.48s user 0.15s system 85% cpu 0.749 total | |
| $ time ./a.out | |
| Name: James Newton, Age: 21, Eye color: brown, Hair color: brown | |
| ./a.out 0.00s user 0.00s system 62% cpu 0.003 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| james@rorschach ~ emcc test.c | |
| test.c:16:53: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion] | |
| Person person = {.name = "James Newton", .age = 21, .colors = {.eyes = "brown", .hair = "brown"}}; | |
| ^~ | |
| test.c:18:79: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat] | |
| printf("Name: %s, Age: %i, Eye color: %s, Hair color: %s\n", person.name, person.age, person.colors.eyes, person.colors.hair); | |
| ~~ ^~~~~~~~~~ | |
| %s | |
| 2 warnings generated. | |
| james@rorschach ~ node a.out.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 42: def user_has_username?(nick) | |
| 43: result = database.execute("SELECT username FROM lastfm WHERE nick = ? LIMIT 1", [nick]) | |
| 44: | |
| => 45: binding.pry | |
| 46: | |
| 47: result.first[0] unless result.count.zero? | |
| 48: end | |
| [1] pry(Howell)> nick | |
| => "newton" | |
| [2] pry(Howell)> result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CS = { | |
| findSelector: function(selector, callback) { | |
| var _this = this; | |
| return function(cssom) { | |
| var rule = _.find(cssom.cssRules, { selectorText: selector }); | |
| callback.apply(_this, [rule]); | |
| } | |
| }, |