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
//manifest.json | |
{ | |
"name": "bookmark-search-export", | |
"version": "1.0", | |
"manifest_version": 2, | |
"description": "This extention will dump all bookmarks", | |
"browser_action": { | |
"default_icon": "icon.png" | |
}, | |
"background": { |
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
### Method 1 | |
gem install oauth2 | |
require 'oauth2' | |
client = OAuth2::Client.new(GOOGLE_KEY, GOOGLE_SECRET, {:site => 'https://accounts.google.com', :authorize_url => "/o/oauth2/auth", :token_url => "/o/oauth2/token"}) | |
response = OAuth2::AccessToken.from_hash(client, :refresh_token => REFRESH_TOKEN).refresh! |
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
wget --mirror -p --convert-links -P ./ <<site>> |
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 CreateMerchantUniqIdGens < ActiveRecord::Migration | |
def change | |
create_table :merchant_uniq_id_gens do |t| | |
t.integer :count, :null => false | |
end | |
# Set initial count to 100 | |
single_row = MerchantUniqIdGen.new | |
single_row.count = 100 | |
single_row.save! |
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
module MyAppEncryptor | |
app = Rails.application | |
config = app.config | |
# PBKDF2 with SHA-1 | |
key_generator = ActiveSupport::KeyGenerator.new(app.secrets[:secret_key_base], iterations: 1000) | |
secret = key_generator.generate_key(config.action_dispatch.encrypted_cookie_salt) | |
sign_secret = key_generator.generate_key(config.action_dispatch.encrypted_signed_cookie_salt) |
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
module RandomAlphaNumeric | |
@deck = [(0..9), ('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten | |
def self.generate(length) | |
@deck.shuffle[0, length].join | |
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
##[https://github.com/docker/docker/issues/9697#issuecomment-67232206 Install specific version of docker (Ubuntu)]## | |
echo deb http://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list | |
apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
apt-get update | |
apt-get install -y lxc-docker-1.3.3 |
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
import com.facebook.yoga.*; | |
public class HelloWorld { | |
public static void main(String s[]) { | |
YogaNode root = new YogaNode(); | |
root.setWidth(500); | |
root.setHeight(300); | |
root.setAlignItems(YogaAlign.CENTER); | |
root.setJustifyContent(YogaJustify.CENTER); | |
root.setPadding(YogaEdge.ALL, 20); |
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
java_binary( | |
name = 'hello', | |
main_class = 'HelloWorld', | |
deps = [':hello_lib'], | |
) | |
java_library( | |
name = 'hello_lib', | |
srcs = ['HelloWorld.java'], | |
resources = [], |
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
import 'dart:async'; | |
import 'dart:isolate'; | |
var mainReceivePort = new ReceivePort(); | |
main() async { | |
await Isolate.spawn(hello, null); | |
await for (var msg in mainReceivePort) { | |
print(msg); | |
return; |