Skip to content

Instantly share code, notes, and snippets.

View alexnodejs's full-sized avatar
🎯
Focusing

Alexander Vasileyko alexnodejs

🎯
Focusing
View GitHub Profile
@alexnodejs
alexnodejs / machine.js
Last active January 25, 2022 19:50
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@alexnodejs
alexnodejs / script.js
Last active October 11, 2019 10:14
Find every scrollable element in the DOM (ES6 one-liner)
[...document.querySelectorAll('*')].filter(el => (el && (el.scrollHeight > el.offsetHeight) && !(el.offsetWidth > el.scrollWidth)));
@alexnodejs
alexnodejs / async-calls
Created May 14, 2015 00:00
Wait for multiple async calls and do something after that (Swift)
let url = NSURL(string: "https://www.google.net")
let request = NSURLRequest(URL: url!)
let group = dispatch_group_create()
for index in 1...100 {
dispatch_group_enter(group)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
println("\(index) complete")
dispatch_group_leave(group)
}
@alexnodejs
alexnodejs / Gruntfile.js
Created September 6, 2013 13:00
build/compile
grunt.registerTask( 'build', [
'clean:build', 'html2js', 'jshint', 'coffeelint', 'coffee', 'recess:build',
'copy:build_assets', 'copy:build_appjs', 'copy:build_vendorjs', 'copy:build_fixturejs',
'index:build', 'karmaconfig', 'karma:continuous', 'karma:e2e', 'gitinfo', 'replace:inject_version'
]);
/**
* The `compile` task gets your app ready for deployment by concatenating and
* minifying your code.
*/
/**
* Guidance directive module's unit test spec
*/
describe('guidanceDirective section', function () {
var scope, elm, $compile;
beforeEach(module('guidanceDirective'));
angular.module('odesk').service('oj3', function() {
return {
subscribe: function(){},
trigger: function(){}
}
});
angular.module('MCCtrl').controller(function($scope, oj3) {
// oj3.???
});
// Your code
&:last-child {
td {
border-bottom: 0;
}
}
&.isSelected {
td {
background-color: #f2f8fd;
}
localhost:odesk-mobile alexander$ curl -H "x-odesk-auth: 4417794da08d9380f44043e05a51e338" http://localhost:8888/v0/jobs?q=java&limit=1&type=fixed
[1] 2092
[2] 2093
localhost:odesk-mobile alexander$ [
{
"id": "200217246",
"clientId": "201600",
"description": "Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1Design HR 1",
"title": "Design HR 1",
"total": 0,
/* several improvements */
.oHint, .oCountdown {
display: inline;
font-size: 11px;
color: #666;
padding-top: 4px;
float: left;
width: inherit;
}
// request
// curl -X POST http://localhost:8888/v0/login -d username=ggrey -d 'password=strange!'
{
"tokens": {
"token": "a0bf29a83bd9c29855c896fda060dec0",
"resource": "Token"
},
"settings": {
"defaults": {