Skip to content

Instantly share code, notes, and snippets.

View 0xjmp's full-sized avatar

Jake Peterson 0xjmp

View GitHub Profile
@0xjmp
0xjmp / Procfile
Last active July 18, 2020 15:21
How to set up a Rails and Webpack app for fun and profit
api: sh -c "cd api && bundle exec rails s -p5000"
nginx: /usr/bin/nginx -c nginx.conf
client: sh -c "cd client && npm start"
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"");
});
Array
(
[Host] => test.gumgum.com
[Referer] => http://test.gumgum.com/ios/api.html?pi=2&sh=568&sw=320&t=ggumtest&id=Beauty,%20Lifestlye,%20Leisure&pu=http://www.vogue.com
[Accept-Encoding] => gzip, deflate
[Accept] => */*
[Cookie] => 784025BT=2uKlc8-sIBd98xdA2l0rHsBI6vs9MVU8yz4uF6oDncdqYWbVhrGLaADw3Yt49GLs3uRvJ_o25ErzlNownNZLFMjDPdcYFDejrrAmZWzwEcv29pxnQu9qXOhT0oEIZydqQSDwYCsPJYvkq-q-bQCO-Q874d8ODuMvZmZJB61Ijz9QsRGdQ3PvbCnoytCudB-M1X9HrP1Be7zAReTecZGWOp1g1LKrnDH4xcEf6Urp9GdEvZ1SelwbepuLbjS-W830i1F701PsoUOo3C4iwFmKbj4Wd3D1ro5eqbVihMW_2XoMGhQx5G8qIiPTQG0m-HLmvovUwGGyIh12kOyd9Z0Z6kVHNJSGd0wpDNhv00s9ru0qCPu0btNBV-VaDpiKsjSlVIDK2hhE34KPLjjDAfztgu2I2jmDuCFwugm7n_PhbAAKTn5eViAIHDdq8ZUtmor4aIpQu8NsO7tcM4OVXrvtII5Zn-og2R_8COsVt8GuyGGdNdoYcmHJYMk7AT8UqlFWNc-4Coh0eSypuVX5-HoYHukw5xcvK4wejQYRAVzp3bhbZJz9Hp0-C5lUkFLLp2zTtubinV8e_paI9l10HwJb5DmYcmNC6XnhX3rPHZXfHel-zTuRxOhmYnJb0; __aavi=3322049309638015867; __aavt=1427843580076; __cfduid=d86bbdb8dc1ba0a90e3b61b2097ade5381427758732; _ga=GA1.2.1502943310.1
document.getElementByTagName('meta')[0].content = "width=" + image_width;
this.Factory = function($resource) {
return $resource('/user/:userId', {userId: '@id'});
};
this.Controller = function($scope) {
$scope.get = function() {
Factory.get({userId: 123}, function(response_data) {
user = response_data.user;
});
};
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(user) {
user.abc = true;
user.$save();
});
.when('/users/sign_in', {
templateUrl: 'sign-in.html'
})
.when('/users/sign_up', {
templateUrl: 'sign-up.html'
})
.when('/users/:id', {
templateUrl: 'user.html'
})
angular.module('app', []).config = function($httpProvider) {
var authToken = $("meta[name=\"csrf-token\"]").attr("content");
$httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken;
$httpProvider.defaults.headers.patch = {
'Content-Type': 'application/json;charset=utf-8'
};
};
@0xjmp
0xjmp / doc.html
Last active August 29, 2015 14:15
<!doctype html>
<head>
<script>
GUMGUM = {
byId: function(uid){ return document.getElementById(uid) },
loadImg: function(url) { console.log('Loaded img:', url); },
loadScript: function(url) { console.log('Loaded script:', url); }
}
</script>
</head>
@0xjmp
0xjmp / home_ctlr.js
Last active August 29, 2015 14:14
An example of a unit test (jasmine) of a service and controller
// You would still need to define this in a module
// for it to work in a real world environment.
this.HomeCtlr = function($scope, Project) {
$scope.search = function(query) {
$scope.projects = Project.search({query: query});
};
};