This file contains 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
App.js | |
import React, { Component } from 'react'; | |
import TaskList from './TaskList'; | |
import AddTask from './AddTask'; | |
export default class App extends Component { | |
render() { | |
return ( | |
<div> |
This file contains 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
// state looks like this | |
{ | |
userIds: [ 1, 2], | |
usersById: { | |
1: { | |
name: 'Jakub' | |
}, | |
2: { | |
name: 'Horsebeast' | |
} |
This file contains 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
SCrypt::Ext.instance_eval do | |
def crypto_scrypt(secret, secret_bytesize, salt, salt_bytesize, n, r, p, buffer, key_len) | |
# buffer is a FFI::MemoryPointer | |
buffer.write_string secret | |
0 # retval | |
end | |
end |
This file contains 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 CreateResidences < ActiveRecord::Migration | |
def change | |
create_table :residences do |t| | |
t.string :name | |
t.string :address | |
t.belongs_to :zipcode, index: true | |
t.timestamps null: false | |
end | |
add_foreign_key :residences, :zipcodes |
This file contains 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
#!/bin/bash | |
# Usage: ./filename frequency_in_seconds folder_path | |
# If the script doesn't work, you may need imagemagick: | |
# $ sudo apt-get install imagemagick | |
x=1 | |
if [[ -f ${2}/screenshot1.png ]]; then |
This file contains 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('Test') | |
function Test:__init() | |
self.timer = Timer() | |
math.randomseed(1234) | |
Events:Subscribe("PreTick", self, self.Tick) | |
end | |
function Test:Tick() | |
if self.timer:GetMilliseconds() < 300 then |
This file contains 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
function WPB:Render() | |
for i,pos in ipairs(self.waypoints) do | |
local angle = Angle( Camera:GetAngle().yaw, 0, math.pi ) * Angle( math.pi, 0, 0 ) | |
Render:SetTransform(Transform3():Translate(pos):Rotate( angle )) | |
Render:DrawCircle(Vector3(0,0,0), 2, Color(200, 200, 200)) | |
local text = tostring(i) | |
local text_size = Render:GetTextSize( text, TextSize.Large ) / 10 |
This file contains 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
upstream unicorn_wrh { | |
server unix:/tmp/unicorn.wrh.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name hostname.tld; | |
root /home/deployer/apps/wrh/current/public; | |
location ^~ /assets/ { |
This file contains 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
require 'net-ssh-shell' | |
require 'net-ssh' | |
Trying to run: | |
$ ruby deploy.rb udp 10 oi10osm edu/dod/lab1 1 ↵ | |
/Users/orvar/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate net-ssh-shell-0.2.0, because net-ssh-2.6.0 conflicts with net-ssh (~> 2.1.0) (Gem::LoadError) | |
from /Users/orvar/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/specification.rb:746:in `activate' | |
from /Users/orvar/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate' | |
from /Users/orvar/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems.rb:209:in `try_activate' | |
from /Users/orvar/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' |
This file contains 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
require 'eventmachine' | |
module ProxyServer | |
def post_init | |
puts "-- someone connected to the echo server!" | |
@@connections ||= [] | |
@@connections << self | |
end | |
def receive_data data |
NewerOlder